home *** CD-ROM | disk | FTP | other *** search
- /*
- **
- ** Textra MARKS-Facility Exerciser/Tester
- ** --------------------------------------
- ** Mike Haas - 11 January 1996
- **
- ** Textra 1.15 introduced the MARKs facility, a convienient
- ** method of setting persistant "bookmarks" with user-definable
- ** names to any section of a file. Unfortunately, Textra 1.16
- ** and earlier have some problems dealing with the MARKs table
- ** correctly in all edit situations. In those versions, it is
- ** possible for defined Marks to become invisible or change
- ** locations.
- **
- ** This is a test file for Textra's MARKs facility. It opens
- ** 2 windows, one for logging results and the other to actually
- ** conduct its tests in. The MARKs algorithms are extensively
- ** exercised and the results checked. You may log all test
- ** results or only problems. The latest Textra runs all tests
- ** with no problems.
- **
- ** The basic pattern of these tests is to establish various types
- ** of marks (single-line, two-line, multi-line) and place the
- ** cursor in various places (on a previous line, same line
- ** before, within, after, following line) then perform some
- ** operation (del a char, del a select range, etc.) and check
- ** that the mark was properly adjusted or deleted or left
- ** unchanged, depending on the operation.
- **
- ** This script will reveal the problems with Textra 1.16
- ** and earlier, all of which are fixed in Textra 1.17 (which
- ** is in beta, not generally available yet). See what a good idea
- ** it is to register shareware programs? You get the latest and
- ** greatest. In Textra's case, free updates and bonus software,
- ** too!
- **
- ** (For you conspiracy buffs: No, I didn't intentionally put
- ** the bugs in the earlier versions just so I could release this
- ** script as a trick to get people to upgrade :-) Upgrades are
- ** free, silly... see below.)
- **
- ** To run under your Textra (Textra 1.15 or later is required),
- ** simply enter "TestMarks" into an Arexx string gadget and press
- ** return.
- **
- ** Registration/Upgrade information...
- **
- ** Textra 1.17 is under development and will offer significant
- ** feature enhancements... I am in the middle of adding auto-
- ** word-wrap with ProWrite/MS Word-style sliders. In the process
- ** several bugs have been corrected and other enhancements have
- ** been made. These are available to registered users for the
- ** asking (I've always sent upgrades free if you send a SASE-floppy-
- ** mailer and floppy, otherwise send $5 if you want me to provide
- ** everything. New registerees ($25) always get the latest &
- ** greatest, the same version I use. (Checks drawn on U.S. Banks
- ** or U.S. money orders only, please. Don't send cash!).
- **
- ** To order a new Textra or upgrade, send the right stuff to:
- **
- ** Mike Haas
- ** 3867 La Colina Rd.
- ** El Sobrante, CA 94803
- **
- ** For more info: mikeh@starnine.com
- **
- ** Thanks.
- **
- */
-
- options results
-
- rex = 0; result = "NOTSUPPORTED"
- textraversion
- parse var result maj min rex
- if (result == "NOTSUPPORTED") | (rex < 10) then do
- notify "Textra V1.15 or later required for this script."
- exit
- end
-
- prefs autoindent read;ai = result
- prefs autoindent off
-
- ask "Display only those tests which reveal problems?"
- PrintOnlyBad = result
-
- openfile 'ram:Textra Log Window';parse var result logw
- if logw = 0 then do
- notify "Error opening 'Textra Log Window'"
- BeGone()
- end
- clear
-
- openfile '"ram:test window"';parse var result tstw
- if tstw = 0 then do
- closewindow logw
- notify "Error opening 'test window'"
- BeGone()
- end
- clear
- placewindow "-1" 210 "-1" "-1"
-
- testN = 1
-
- selectwindow logw
- newline
- textn '"********************************************************"'
- textn '" Textra MARKS Facility Test 1.0"'
- textn '" ------------------------------"'
- textn '" Testing version 'maj'.'min'"'
- textn '"========================================================"'
-
- nErrors = 0
-
- /* --------------- TEST 1 --------------- */
- str1 = 'Single line mark, cursor on same line, before mark,'
- str2 = 'then delete single character'
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 5 2
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 9) | (sy ~= 2) | (ex ~= 19) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey."9 2 19 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 2 --------------- */
- str1 = "Single line mark, cursor within mark, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 15 2
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 19) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 19 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 3 --------------- */
- str1 = "Single line mark, cursor after mark, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 22 2
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 4 --------------- */
- str1 = "Single line mark, cursor on previous line, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 1
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 5 --------------- */
- str1 = "Single line mark, cursor on following line, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 3
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 6 --------------- */
- str1 = "Single line mark, cursor on same line and before,"
- str2 = "then newline"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 5 2
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 5) | (sy ~= 3) | (ex ~= 15) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"5 3 15 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 7 --------------- */
- str1 = "Single line mark, cursor within mark, then newline"
- str2 = ""
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 15 2
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 5) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 5 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 8 --------------- */
- str1 = "Single line mark, cursor after mark, then newline"
- str2 = ""
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 22 2
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 9 --------------- */
- str1 = "Single line mark, cursor on previous line, then"
- str2 = "newline"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 1
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 3) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 3 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 10 --------------- */
- str1 = "Single line mark, cursor on following line, then"
- str2 = "newline"
- Call InitTstW
- gotoxy 10 2
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 3
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 11 --------------- */
- str1 = "Two-line mark, cursor on start line, before mark,"
- str2 = "then delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 5 1
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 9) | (sy ~= 1) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"9 1 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 12 --------------- */
- str1 = "Two-line mark, cursor within mark, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 15 2
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 19) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 19 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 13 --------------- */
- str1 = "Two-line mark, cursor after mark, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 22 2
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 14 --------------- */
- testn = testn + 1
- str1 = "Two-line mark, cursor on previous line, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 0
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 15 --------------- */
- str1 = "Two-line mark, cursor on following line, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 3
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 16 --------------- */
- str1 = "Two-line mark, cursor on 1st line and before,"
- str2 = "then newline"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 5 1
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 5) | (sy ~= 2) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"5 2 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 17 --------------- */
- str1 = "Two-line mark, cursor within mark, then newline"
- str2 = ""
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 15 2
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 5) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 5 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 18 --------------- */
- str1 = "Two-line mark, cursor after mark, then newline"
- str2 = ""
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 22 2
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 19 --------------- */
- str1 = "Two-line mark, cursor on previous line, then"
- str2 = "newline"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 0
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 20 --------------- */
- str1 = "Two-line mark, cursor on following line, then"
- str2 = "newline"
- Call InitTstW
- gotoxy 10 1
- selectto 20 2
- markselect "%%TESTMARK"
- gotoxy 10 3
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 2)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 2"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 21 --------------- */
- str1 = "Multi-line mark, cursor on start line, before mark,"
- str2 = "then delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 5 1
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 9) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"9 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 22 --------------- */
- str1 = "Multi-line mark, cursor within mark, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 15 2
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 23 --------------- */
- str1 = "Multi-line mark, cursor after mark, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 22 3
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
-
- /* --------------- TEST 24 --------------- */
- testn = testn + 1
- str1 = "Multi-line mark, cursor on previous line, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 10 0
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 25 --------------- */
- str1 = "Multi-line mark, cursor on following line, then"
- str2 = "delete single character"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 10 4
- del
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 26 --------------- */
- str1 = "Multi-line mark, cursor on 1st line and before,"
- str2 = "then newline"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 5 1
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 5) | (sy ~= 2) | (ex ~= 20) | (ey ~= 4)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"5 2 20 4"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 27 --------------- */
- str1 = "Multi-line mark, cursor within mark, then newline"
- str2 = ""
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 15 2
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 4)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 4"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 28 --------------- */
- str1 = "Multi-line mark, cursor after mark, then newline"
- str2 = ""
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 22 3
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 29 --------------- */
- str1 = "Multi-line mark, cursor on previous line, then"
- str2 = "newline"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 10 0
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 2) | (ex ~= 20) | (ey ~= 4)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 2 20 4"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- TEST 30 --------------- */
- str1 = "Multi-line mark, cursor on following line, then"
- str2 = "newline"
- Call InitTstW
- gotoxy 10 1
- selectto 20 3
- markselect "%%TESTMARK"
- gotoxy 10 4
- newline
- gotomark "%%TESTMARK"
- if (result ~= OK) then do
- Call ReportResults(1, "Mark was incorrectly deleted")
- end
- else do
- get select position;parse var result sx' 'sy' 'ex' 'ey
- if ((sx ~= 10) | (sy ~= 1) | (ex ~= 20) | (ey ~= 3)) then do
- Call ReportResults(1,Coords(sx,sy,ex,ey,"10 1 20 3"))
- end
- else
- Call ReportResults(0)
- end
- testn = testn + 1
-
- /* --------------- ALL DONE --------------- */
- selectwindow tstw
- closewindow
- selectwindow logw
- newline
- if (nErrors = 0) then
- textn "No problems occurred."
- else do
- textn nErrors" problems occurred. This Textra should be upgraded..."
- textn "the latest Textra runs this test with no failures. See this"
- textn "script's comment for ordering/free upgrade information."
- end
- BeGone()
- exit /* let's just make sure! :-) */
-
- BeGone:
- prefs autoindent ai
- exit
- return 0
-
- /* ---------------- subroutines ---------------- */
-
- InitTstW:
- Call ShouldIDie()
- selectwindow tstw
- statustext '"Test 'testn'"'
- clear
- deletemark "%%TESTMARK"
- textn "0123456789 123456789 123456789 123456789"
- textn "123456789 123456789 123456789 123456789 "
- textn "23456789 123456789 123456789 123456789 1"
- textn "3456789 123456789 123456789 123456789 23"
- textn "456789 123456789 123456789 123456789 234"
- return
-
- ReportResults:
- parse arg testres,resstr
- if (str1 ~= "") then do
- selectwindow tstw
- if (testres = 0) then
- statustext '"Test 'testn' worked fine"'
- else do
- statustext '"Test 'testn' had a problem"'
- nErrors = nErrors + 1
- end
- end
- if ((PrintOnlyBad == "NO") | ((PrintOnlyBad == "YES") & (testres ~= 0))) then do
- selectwindow logw
- if (str1 ~= "") then
- Call Announce(testres)
- if (testres = 0) then
- textn "TEST OK"
- else
- textn "PROBLEM: "resstr
- end
- return 0
-
- Coords:
- parse arg na,nb,nc,nd,exp
- str = "Mark position = "
- str = overlay(na,str,length(str)+1)
- str = overlay(" ",str,length(str)+1)
- str = overlay(nb,str,length(str)+1)
- str = overlay(" ",str,length(str)+1)
- str = overlay(nc,str,length(str)+1)
- str = overlay(" ",str,length(str)+1)
- str = overlay(nd,str,length(str)+1)
- if (exp ~= "") then do
- str = overlay(" Expected = ",str,length(str)+1)
- str = overlay(exp,str,length(str)+1)
- end
- return str
-
- Announce:
- parse arg res
- if ((PrintOnlyBad == "NO") | ((PrintOnlyBad == "YES") & (res ~= 0))) then do
- selectwindow logw
- newline
- textn '"TEST 'testn' ---------------------------------------------"'
- textn '" 'str1'"'
- str1 = ""
- if (str2 ~= "") then
- textn '" 'str2'"'
- do
- return
-
- ShouldIDie:
- CheckCancel; if (result == CANCEL) then do
- selectwindow tstw
- closewindow
- selectwindow logw
- newline
- textn "Test Canceled"
- BeGone()
- end
- return
-